<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Homework3</title>
</head>
<body>
<pre>
    # ⼀个机器⼈从原点（0，0）出发
    import math

    pos = [0,0]
    while True:
        getInput = input()
        if not getInput:
            continue
        if getInput == 'STOP':
            break
        move = getInput.split()
        if move[0] == 'UP':
            pos[1] += int(move[1])
        elif move[0] == 'DOWN':
            pos[1] -= int(move[1])
        elif move[0] == 'LEFT':
            pos[0] -= int(move[1])
        elif move[0] == 'RIGHT':
            pos[0] += int(move[1])
        else:
            print('unknow commend')
    print( round(math.sqrt( pos[0]**2 + pos[1]**2 )) )
</pre>
</body>
</html>